﻿/*
 * Сделано в SharpDevelop.
 * Пользователь: Кулик
 * Дата: 01.04.2011
 * Время: 14:57
 * 
 * Для изменения этого шаблона используйте Сервис | Настройка | Кодирование | Правка стандартных заголовков.
 */
using System;
using System.Collections.Generic;

namespace Video.Mov
{
//	/// <summary>
//	/// stbl
//	/// </summary>
//	public struct SampleTableAtom:Atom{
//		public SampleDescriptionAtom sampleDescriptionAtom;
//		public TimeToSampleAtom timeToSampleAtom;
//		public SyncSampleAtom syncSampleAtom;
//		public SampleToChunkAtom sampleToChunkAtom;
//		public SampleSizeAtom sampleSizeAtom;
//		public ChunkOffsetAtom chunkOffsetAtom;
//		public ShadowSyncAtom shadowSyncAtom;
//	}
	
	/// <summary>
	/// stsd
	/// </summary>
	public class SampleDescriptionAtom:Atom{
		public SampleDescriptionAtom(Atom atom):base(atom){
			sampleDescriptionTable = new List<SampleDescriptionTableItem>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		//int NumberOfEntries;
		public List<SampleDescriptionTableItem> sampleDescriptionTable;
	}
	
	public class SampleDescriptionTableItem{
		public SampleDescriptionTableItem(){}
		public SampleDescriptionTableItem(SampleDescriptionTableItem item){
			Size = item.Size;
			DataFormat = item.DataFormat;
			Reserved = item.Reserved;
			DataReferenceIndex = item.DataReferenceIndex;
		}
		
		public uint Size;
		public char[] DataFormat;
		public byte[] Reserved = new byte[6];
		public ushort DataReferenceIndex;
	}
	
	/// <summary>
	/// samr
	/// </summary>
	public class AMRSampleEntry:SampleDescriptionTableItem{
		public AMRSampleEntry(SampleDescriptionTableItem item):base(item){}
		
		public byte[] Reserver = new byte[8];
		public ushort Reserver2;
		public ushort Reserver3;
		public uint Reserver4;
		public ushort TimeScale;
		public ushort Reserver5;
		
		//daml
		public uint BoxHeaderSize;
		public char[] BoxHeaderType;
		
		public char[]	vendor;
		public byte		decoder_version;
		public ushort	mode_set;
		public byte	 	mode_change_period;
		public byte	 	frames_per_sample;

	}
	
	/// <summary>
	/// mp4v
	/// </summary>
	public class MP4VisualSampleEntry:SampleDescriptionTableItem{
		public MP4VisualSampleEntry(SampleDescriptionTableItem item):base(item){}
		
		public byte[] Reserver = new byte[16];
		public ushort Width;
		public ushort Height;
		public uint Reserver2;
		public uint Reserver3;
		public uint Reserver4;
		public ushort Reserver5;
		public byte[] Reserver6 = new byte[32];
		public ushort Reserver7;
		public ushort Reserver8;
		
		//esds
		public uint BoxHeaderSize;
		public char[] BoxHeaderType;
		
		//public char[]	vendor;
		//public byte		decoder_version;
		//public ushort	mode_set;
		//public byte	 	mode_change_period;
		//public byte	 	frames_per_sample;

	}
	
	/// <summary>
	/// stts
	/// </summary>
	public class TimeToSampleAtom:Atom{
		public TimeToSampleAtom(Atom atom):base(atom){
			timeToSampleTable = new List<TimeToSampleItem>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		//int NumberOfEntries;
		public List<TimeToSampleItem> timeToSampleTable;
	}
	
	public class TimeToSampleItem{
		public uint SampleCount;
		public uint SampleDuration;
	}
	
	/// <summary>
	/// stss
	/// </summary>
	public class SyncSampleAtom:Atom{
		public SyncSampleAtom(Atom atom):base(atom){
			SyncSampleTable = new List<uint>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		//int NumberOfEntries;
		public List<uint> SyncSampleTable;
	}
	
	/// <summary>
	/// stsc
	/// </summary>
	public class SampleToChunkAtom:Atom{
		public SampleToChunkAtom(Atom atom):base(atom){
			SampleToChunkTable = new List<SampleToChunkItem>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		//int NumberOfEntries;
		public List<SampleToChunkItem> SampleToChunkTable;
	}
	
	public struct SampleToChunkItem{
		public uint FirstChunck;
		public uint SamplesPerChunk;
		public uint SamplesDescription;
	}
	
	/// <summary>
	/// stsz
	/// </summary>
	public class SampleSizeAtom:Atom{
		public SampleSizeAtom(Atom atom):base(atom){
			SampleSizeTable = new List<uint>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		public uint SampleSize;
		//int NumberOfEntries;
		public List<uint> SampleSizeTable;
	}
	
	/// <summary>
	/// stco
	/// </summary>
	public class ChunkOffsetAtom:Atom{
		public ChunkOffsetAtom(Atom atom):base(atom){
			ChunkOffsetTable = new List<uint>();
		}
		//byte Version;
		//byte[] Flags = new byte[3];
		//int NumberOfEntries;
		public List<uint> ChunkOffsetTable;
	}
	
	/// <summary>
	/// atsh
	/// </summary>
	public class ShadowSyncAtom:Atom{
		
	}
	
}
